Skip to content

fix(docs): prerender every docs page - #202

Merged
erkamyaman merged 1 commit into
santoshyadavdev:mainfrom
erkamyaman:fix/docs-prerender
Oct 2, 2026
Merged

erkamyaman merged 1 commit into
santoshyadavdev:mainfrom
erkamyaman:fix/docs-prerender

Conversation

@erkamyaman

@erkamyaman erkamyaman commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

The docs site prerendered only the home page, so opening or refreshing any other docs URL showed the home page until Angular loaded and swapped in the real page. This takes the same fix as NgMd (erkamyaman/ngmd@08dbcae):

  • plugin-utils.ts: siteRoutes() and prerenderRoutes() list every page, content page and API symbol page in one place
  • vite.config.ts: passes prerender.routes to Analog, so the build writes an HTML file per page plus 404.html
  • sitemap.plugin.ts and api-gen.plugin.ts: use the same route list as the prerender step

When the site is deployed, the host should serve 404.html for unknown paths rather than rewriting every path to index.html, or the home page shows up again.

Checks

  • pnpm docs:build: 37 HTML files (34 docs pages, /, /sponsors and 404.html) and 35 sitemap entries; each page has its own title (for example Angular DevTools | Router)
  • The docs app tests (101), pnpm format:check and pnpm skills:check pass

Summary by CodeRabbit

  • New Features
    • Documentation sites now include generated API reference pages in their route listings and prerendered output.
    • Prerendering now includes the not-found page, and route listings cover available static pages and content pages.
  • Bug Fixes
    • Pages marked noIndex are excluded from the sitemap, while existing routes are preserved when a content page is marked noIndex.

The docs site prerendered only the home page, so opening or refreshing
any other URL on a host with a fallback to index.html showed the home
page until Angular loaded and swapped in the real page. It now
prerenders every page and a 404.html from the route list the sitemap
uses, taken from the same fix in NgMd.
@github-actions github-actions Bot added the area: docs The documentation site label Oct 2, 2026
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Essentials

Run ID: a31b4c5e-9578-454b-8788-6f2fc882201c

📥 Commits

Reviewing files that changed from the base of the PR and between 84837fd and c7e1c23.

📒 Files selected for processing (4)
  • apps/docs/api-gen.plugin.ts
  • apps/docs/plugin-utils.ts
  • apps/docs/sitemap.plugin.ts
  • apps/docs/vite.config.ts

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.


📝 Walkthrough

Walkthrough

The documentation site now shares route discovery across prerendering and sitemap generation. The route list includes API symbol routes, tracks noIndex for content routes, and adds /404.html to prerender routes.

Changes

Documentation site routes

Layer / File(s) Summary
API route extraction
apps/docs/api-gen.plugin.ts
Configuration parsing, project creation, and API record extraction use shared helpers. The exported apiRoutes(root) maps extracted records to /api/<group>/<name> routes and source files.
Shared route aggregation
apps/docs/plugin-utils.ts
siteRoutes(root) combines static page, content, and API routes. Content frontmatter provides the noIndex status; existing routes are retained when a content route is noIndex. Results are sorted. prerenderRoutes(root) adds /404.html.
Prerender and sitemap integration
apps/docs/vite.config.ts, apps/docs/sitemap.plugin.ts
Vite obtains prerender routes from prerenderRoutes. Sitemap generation uses siteRoutes, excludes routes marked noIndex, and gets dates from gitDate.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Analog
  participant prerenderRoutes
  participant siteRoutes
  participant apiRoutes
  Analog->>prerenderRoutes: Request prerender routes
  prerenderRoutes->>siteRoutes: Collect site routes
  siteRoutes->>apiRoutes: Get API routes
  apiRoutes-->>siteRoutes: Return API routes and source files
  siteRoutes-->>prerenderRoutes: Return sorted page, content, and API routes
  prerenderRoutes-->>Analog: Return routes with /404.html
Loading

Merge Risk: ⚪ Minimal · up to c7e1c

No actionable issue identified here prevents merging after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: configuring the docs application to prerender every docs page.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


A rabbit maps the pages with care
API paths join the routes out there
Content flags mark what should not show
Sorted paths help the builders know
/404.html hops along the way
Then off the rabbit bounds to play

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit c7e1c23

Command Status Duration Result
nx affected -t test build ✅ Succeeded 1m 40s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-02 13:49:06 UTC

@erkamyaman
erkamyaman merged commit 78a0392 into santoshyadavdev:main Oct 2, 2026
7 checks passed
@erkamyaman
erkamyaman deleted the fix/docs-prerender branch October 2, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs The documentation site

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant